using FireStarterModeller.BO;
using Habanero.Testability;

namespace FireStarterModeller.Test
{
    public class TestUtilsDMLookupLisBusinessObject
    {
        public static BOTestFactory<DMLookupListBusinessObject> GetBuilder()
        {
            return BOTestFactoryRegistry.Instance.Resolve<DMLookupListBusinessObject>();
        }

        /// <summary>
        /// Creates a new saved DMLookupList with a random value assigned to every property
        /// </summary>
        public static DMLookupListBusinessObject CreateSavedDMLookupListBusinessObject()
        {
            DMLookupListBusinessObject dMLookupList = CreateUnsavedValidDMLookupListBusinessObject();
            dMLookupList.Save();
            return dMLookupList;
        }

        /// <summary>
        /// Creates a new unsaved DMLookupList with a random value assigned to every property
        /// </summary>
        public static DMLookupListBusinessObject CreateUnsavedValidDMLookupListBusinessObject()
        {
            return GetBuilder()
                .CreateValidBusinessObject();
        }
        /// <summary>
        /// Creates a new unsaved DMLookupList with a random value assigned to every property
        /// </summary>
        public static DMLookupListBusinessObject CreateStandardDMLookupListBO()
        {
            return GetBuilder()
                .WithValue(boList => boList.Generated, true)
                .WithValue(boList => boList.AssemblyName, "AssemblyName")
                .WithValue(boList => boList.Criteria, "Criteria")
                .WithValue(boList => boList.ClassName, "ClassName")
                .WithValue(boList => boList.Timeout, 4)
                .WithValue(boList => boList.DMSortOrder, TestUtilsDMSortProperty.CreateStandardDMSortProperty().DMSortOrder)
                .CreateValidBusinessObject();
        }

        /// <summary>
        /// Creates a new unsaved DMLookupList where all properties are null, except ID properties
        /// and those with default values.  If there are compulsory properties without
        /// defaults, saving the object will throw an exception.
        /// </summary>
        public static DMLookupListBusinessObject CreateUnsavedDefaultDMLookupListBusinessObject()
        {
            DMLookupListBusinessObject dMLookupList = new DMLookupListBusinessObject();
            return dMLookupList;
        }
    }
}